//package cn.zl.netty.server;
//
//import io.netty.buffer.ByteBuf;
//import io.netty.buffer.Unpooled;
//import io.netty.channel.ChannelHandlerContext;
//import io.netty.channel.ChannelInboundHandlerAdapter;
//import io.netty.util.CharsetUtil;
//
///**
// * @Description:服务器的处理器
// * @Author: zhanglang
// * @Date: 2020/8/24 9:22
// */
//public class SimpleServerHandler extends ChannelInboundHandlerAdapter {
//    @Override
//    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
//        System.out.println("SimpleServerHandler.channelRead");
//        ByteBuf buf = (ByteBuf) msg;
//        System.out.println("Server received: " + buf.toString(CharsetUtil.UTF_8));
//
//        ByteBuf byteBuf = Unpooled.copiedBuffer("happy", CharsetUtil.UTF_8);
//        ctx.writeAndFlush(byteBuf);
//    }
//
//    @Override
//    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
//        cause.printStackTrace();
//        ctx.close();
//    }
//}
